<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>
        <button id="left">左边</button>
    </div>
    <img src='/笔记/js/素材/index.jfif'>
    <div>
        <button id='right'>右边</button>
    </div>
    <script>
        var button1=document.querySelector('#left');
        var button2=document.querySelector('#right');
        var imagele=document.querySelector('img');
        var imagele1=new Array;
        var i=0;
        imagele1[0]="/笔记/js/素材/index.jfif";
        imagele1[1]="/笔记/js/素材/index1.jfif";
        imagele1[2]="/笔记/js/素材/index2.jfif";
        button1.onclick = function(){
            i++;
            i=i%3;
            imagele.src=imagele1[i];
        }
        button2.onclick=function(){
            i--;
            i=(i+3)%3;
            imagele.src=imagele1[i];
        }
    </script>
</body>
</html>